package com.jt.service.impl;

import com.jt.mapper.UserMapper;
import com.jt.pojo.UserPojo;
import com.jt.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public List<UserPojo> findAll() {
        return userMapper.selectList(null);
    }

    @Override
    public UserPojo findById(int id) {
        return userMapper.selectById(id);
    }

    @Override
    public String updataById(UserPojo userPojo) {
        return userMapper.updateById(userPojo) == 1 ? "修改成功" : "修改失败";
    }

    @Override
    public String deleteById(int id) {
        return userMapper.deleteById(id) == 1 ? "删除成功" : "删除失败";
    }
}
